﻿<Window x:Class="NobleTech.Products.CreatureKingdom.WPFClient.WorldWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c="clr-namespace:NobleTech.Products.CreatureKingdom.WPFClient.Controls"    
    Title="Creature Kingdom" Height="625" Width="952" WindowState="Maximized" >
    <Window.Resources>
        <c:RoundConverter x:Key="RoundConverter"/>        
        <c:HasSelectedIndexConverter x:Key="HasSelectedIndexConverter"/>
    </Window.Resources>
    <DockPanel Margin="0,0,0,0" VerticalAlignment="Stretch"  HorizontalAlignment="Stretch">        
        <Grid DockPanel.Dock="Left" Width="250" Background="WhiteSmoke">
            <StackPanel Margin="10,0,10,0">
                <c:MapSelector Margin="0,20,0,0" Width="230" Height="230" BorderBrush="Black" BorderThickness="1" MapPositionX="{Binding ElementName=cMap, Path=MapPositionX, Mode=TwoWay}" MapPositionY="{Binding ElementName=cMap, Path=MapPositionY, Mode=TwoWay}" MapZoom="{Binding ElementName=cMap, Path=MapZoom}" MapSizeX="{Binding ElementName=cMap, Path=MapSizeX}" MapSizeY="{Binding ElementName=cMap, Path=MapSizeY}" MapPixelSizeX="{Binding ElementName=cMap, Path=ActualWidth}" MapPixelSizeY="{Binding ElementName=cMap, Path=ActualHeight}">
                    <c:MapSelector.Background>
                        <ImageBrush ImageSource="Images/map.jpg" Stretch="Fill"/>
                    </c:MapSelector.Background>
                </c:MapSelector>

                <StackPanel   Margin="0,5,0,0" Orientation="Horizontal">
                    <Slider Height="22" Name="sZoom" Width="160" Ticks="1, 2, 3, 4, 5, 6, 7, 8, 9, 10" Minimum="1" Maximum="10" Delay="100" Value="4" Interval="1" TickPlacement="BottomRight" Foreground="Black"/>
                    <TextBlock Foreground="Black" Text="Zoom: "/>
                    <TextBlock Foreground="Black" Text="{Binding ElementName=sZoom, Path=Value, Converter={StaticResource RoundConverter}}"/>
                    <TextBlock Foreground="Black" Text="x"/>
                </StackPanel>
                
                <StackPanel  Margin="0,25,0,10" Orientation="Horizontal">
                <Button Content="Restart" Name="bRestart" Click="bRestart_Click" Width="115"></Button>
                <Button Content="Go" Name="bGo" Click="bGo_Click" Width="115"></Button>
                </StackPanel>
                
                <DockPanel Margin="0,20,0,0">
                    <StackPanel DockPanel.Dock="Left">                       
                        <TextBlock Foreground="Black"  Margin="0,10,0,0" Width="110" FontWeight="Bold">Loaded Organisms</TextBlock>
                        <ListBox Name="lOrganisms" Width="110" Height="80" DisplayMemberPath="Name"/>
                    </StackPanel>
                    <StackPanel Margin="10,0,0,0">
                        <Button  Margin="0,50,0,0" Content="Load Assembly" Name="bLoad" Click="bLoad_Click" Width="110"></Button>
                        <Button  Margin="0,10,0,0" Width="110" Name="bAdd" Click="bAdd_Click" IsEnabled="{Binding ElementName=lOrganisms, Path=SelectedIndex, Converter={StaticResource HasSelectedIndexConverter}}">Add Creature</Button>
                    </StackPanel>
                </DockPanel>
                
                <StackPanel  Margin="0,30,0,0"  Orientation="Horizontal">
                    <TextBlock Foreground="Black" Text="Display grid: "/>
                    <CheckBox Foreground="Black" Name="cDisplayGrid"/>
                </StackPanel>
                
                <TextBlock Margin="0,30,0,0" Foreground="Black" Text="Statistics" FontWeight="Bold"/>
                <ListBox Name="cStats" Margin="0,00,0,10" Width="230" Height="80"/>

            </StackPanel>
        </Grid>
        <c:Map x:Name="cMap" BorderBrush="Black" BorderThickness="1" MapPositionX="5000" MapPositionY="5000" MapZoom="{Binding ElementName=sZoom, Path=Value}" DisplayGrid="{Binding ElementName=cDisplayGrid, Path=IsChecked}">
            <c:Map.Background>
                <ImageBrush ImageSource="Images/map.jpg" Stretch="Fill"/>
            </c:Map.Background>
        </c:Map>
    </DockPanel>    
</Window>
